#include"processbar.h"
typedef void (*call_back)(int);//定义一个函数指针类型
void download(call_back cd)
{
    int total=1000;//1020MB
    int part=0;    //下载的量
    while(part<=total)
    {
        int rate=part*100/total;
        cd(rate);
        usleep(500000);
        part+=10;
    }
    printf("\n");
    initpb();
}
int main()
{
    printf("1\n");
    download(processbar);
    
    printf("2\n");
    download(processbar);
    return 0;
}
